
#include "LongCommand.h"



void * singleFunc(void * arg){
    int sockfd = createSockfd("192.168.220.128","9999");
    listen(sockfd,10);
    PthreadPoolS pps;
    PthreadPoolSInit(&pps,2);
    int epollfd = epoll_create(1);
    addEpollNode(epollfd,sockfd);
    struct epoll_event readyset[1024];
    while(1){
        int readynum = epoll_wait(epollfd,readyset,1024,-1);
        for(int i = 0 ; i < readynum ; ++i){
            if(readyset[i].data.fd == sockfd){
                int netfd = accept(sockfd,NULL,NULL);
                pthread_mutex_lock(&pps.lock1);
                addQueueNode(&pps.rdq,netfd);
                pthread_cond_broadcast(&pps.cond);
                pthread_mutex_unlock(&pps.lock1);
            }         
        }
    }
    pthread_exit(NULL);
}

